package com.zhiyou.brank.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zhiyou.brank.service.FlyScheduleService;
import com.zhiyou.model.FySchedule;
import com.zhiyou.utils.JsonResult;

@RestController
@RequestMapping("schedule/")
public class FlyScheduleController {
@Autowired
FlyScheduleService flyScheduleService;

@GetMapping(value="selectScheduleOne/{class_id}/{week}")
public JsonResult selectScheduleOne(@PathVariable("class_id")Integer class_id,@PathVariable("week")String week,HttpServletRequest req,HttpServletResponse rep){
	return new JsonResult(flyScheduleService.selectScheduleOne(class_id,week),"查询成功");		
}
@GetMapping(value="selectScheduleTwo/{class_id}")
public JsonResult selectScheduleTwo(@PathVariable("class_id")Integer class_id,HttpServletRequest req,HttpServletResponse rep){
	return new JsonResult(flyScheduleService.selectScheduleTwo(class_id),"查询成功");		
}
@PostMapping(value="addSchedule")
public void addSchedule(FySchedule fySchedule,HttpServletRequest req,HttpServletResponse rep){
	flyScheduleService.addSchedule(fySchedule);	
}
@PostMapping(value="updateSchedule")
public void updateSchedule(FySchedule fySchedule,HttpServletRequest req,HttpServletResponse rep){
	flyScheduleService.updateSchedule(fySchedule);
}
@PostMapping(value="deleteSchedule")
public void deleteSchedule(Integer schedule_id,HttpServletRequest req,HttpServletResponse rep){
	flyScheduleService.deleteSchedule(schedule_id);;
}
}
